<!-- <template>
  <div class="KnowledgeBasePreview" style="height: 100%;">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EmergencyPlan' }">应急预案</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/KnowledgeBase' }">知识库</el-breadcrumb-item>
        <el-breadcrumb-item>预览</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <Preview :base="base" :url="url" @download="getDownload"></Preview>
  </div>
</template>

<script>
import { getByIdApi } from "@/api/EmengercyPlan/zsk";
import { loadFile } from "@/api/common.js";
import Preview from "../components/Preview";
export default {
  name: "KnowledgeBasePreview",
  components: {
    Preview
  },
  data() {
    return {
      // base: "http://192.168.0.193:9000/",
      base: "http://192.168.0.193:19000/",
      url: "",
      fileIdInfo: [],
      attachId: ""
    };
  },
  created() {
    // this.url = this.base + "demo/demo1.docx";
  },
  mounted() {
    this.getById();
  },
  methods: {
    getById() {
      getByIdApi({ id: this.$route.query.id }).then(res => {
        this.fileIdInfo = res.fileIdInfo;
        this.attachId = res.fileIdInfo[0].attachId;
        loadFile({ id: this.attachId }).then(data => {
          console.log("文件地址", data);
          // this.url = data;
        });
      });
    },
    getDownload() {
      getByIdApi({ id: this.$route.query.id }).then(res => {
        this.fileIdInfo = res.fileIdInfo;
        this.attachId = res.fileIdInfo[0].attachId;
        loadFile({ id: this.attachId }).then(data => {
          window.open(data);
        });
      });
    }

  }
};
</script>

<style lang='less' scoped>
@import "../../../assets/style/common.less";
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/pop-upNotification.less";

:deep(.el-breadcrumb__inner.is-link) {
  font-weight: 100;
  color: #fff;
}

:deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
  color: #3270ff;
}

:deep(.el-descriptions-item__label:not(.is-bordered-label)) {
  margin-right: 5px;
}
</style> -->
